﻿using Ecommerce.Domain.Rabbit;
using EcommerceRabbit.API.Application.Command.Trace;
using EcommerceRabbit.Servies.traceability;
using MediatR;

namespace EcommerceRabbit.API.Application.CommandHandler.Trace
{
    public class EnterGetCommandHandler : IRequestHandler<EnterGetCommand, List<Enterprise>>
    {
        private readonly ITraceServices services;

        public EnterGetCommandHandler(ITraceServices services)
        {
            this.services = services;
        }

        public Task<List<Enterprise>> Handle(EnterGetCommand request, CancellationToken cancellationToken)
        {
            return services.GetEnterprises(request.Cid);
        }
    }
}
